define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'evaluation.elist/index',
        add_url: 'evaluation.elist/add',
        edit_url: 'evaluation.elist/edit',
        delete_url: 'evaluation.elist/delete',
        export_url: 'evaluation.elist/export',
        modify_url: 'evaluation.elist/modify',
        exportView_url: 'evaluation.elist/exportView'
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                search:true,
                // modifyReload: true,
                toolbar: ['refresh', 'delete', 'export', 'exportView',
                    // [{
                    //     text: '视图导出',
                    //     url: init.exportView_url,
                    //     method: 'request',
                    //     class: 'layui-btn layui-btn-sm layui-btn-success easyadmin-export-btn',
                    //     icon: 'fa fa-file-excel-o',
                    //     title:'根据查询进行导出，确定导出？',
                    //     auth: 'exportView',
                    //     // extend: 'data-full="true"',//是否全屏打开
                    // }]
                ],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID',search:false},
                    {field: 'evaluationTemplate.name', title: '模板名称',search:false},
                    {field: 'users.nickname', title: '用户昵称',search:false},
                    {field: 'users.head_pic', title: '用户头像',search:false,templet: ea.table.image},
                    {field: 'class_name', title: '班级',search:false},
                    {field: 'student_name', title: '学生姓名',search:false},
                    // {field: 'tel', title: '联系电话'},
                    // {field: 'scores', title: '五星评价',search:false,hide:true},
                    // {field: 'images', title: '图片/视频', templet: ea.table.image,search:false,hide:true},
                    // {field: 'isanonymous', title: '是否匿名',selectList: {1: '是', 2: '否'}},
                    // {field: 'type', title: '是否追评',selectList: {1: '是', 2: '否'}},
                    {field: 'admin_id', title: '采集所属',selectList:getAdminList, search:'select'},
                    {field: 'create_time', title: '创建时间',search:'range'},
                    {width: 250, title: '操作', templet: ea.table.tool,operat: [
                    [{
                        class: 'layui-btn layui-btn-normal layui-btn-xs',//
                        method: 'open',
                        text: '详情',
                        auth: 'edit',
                        url: init.edit_url,
                        extend: 'data-full="true"',
                    }],'delete'
                        ]
                    },
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        export: function () {
            ea.listen();
        },
    };
    return Controller;
});